package org.example.deadletter;

import com.rabbitmq.client.AMQP;
import com.rabbitmq.client.Channel;
import org.example.utils.RabbitMqUtils;

/**
 * @author zfj
 * @date 2022/4/24 -21:07
 */
public class Producer {
	//普通交换机名称
	private static final String NORMAL_EXCHANGE = "normal_exchange";

	public static void main(String[] args) throws Exception {
		Channel channel = RabbitMqUtils.getChannel();
		//延迟消息或死信消息 设置TTL lime to live  单位是毫秒
//		AMQP.BasicProperties properties=new AMQP.BasicProperties()
//				.builder().expiration("10000").build();
		for (int i = 1; i <11 ; i++) {
			String message="info"+i;
			channel.basicPublish(NORMAL_EXCHANGE, "zhangsan", null,
					message.getBytes());
			System.out.println("生产者发送消息:"+message);
		}
	}
}
